package LeedCode.Iterator;

import java.util.ArrayList;
import java.util.Iterator;

public class Main {
    public static void main(String[] args) {
        System.out.println("HelloWorld!");
        ArrayList<String> arrayList=new ArrayList<>();
        arrayList.add("Google");
        arrayList.add("Runoob");
        arrayList.add("Taobao");
        arrayList.add("Zhihu");

        Iterator<String> iterator=arrayList.iterator();//创立一个数组的迭代器

//        System.out.println(iterator.next());
        while (iterator.hasNext()){
            String i=iterator.next();
            if(i=="Google"){
                iterator.remove();
                break;
            }
        }
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }

    }
}
